#ifndef EDITORVIEW_H
#define EDITORVIEW_H

#include "view.h"
#include "scrollskin.h"
#include "scrollbar.h"
class App;
class Font;
class PatternEditor;
class RowLabel;
class ColumnLabel;

// pattern/song editor view base class
class EditorView : public View {
public:
     EditorView(App *pApp, Rect rect, Font *pFont);
     virtual ~EditorView();
     // slots to connect to scroll bars onPosChange signals
     void updateRowOffset(int offset);
     void updateColOffset(int offset);

protected:
     static const int NoRow = -1;
     static const int LineThickness = 1;
     PatternEditor *m_pEditor;
     ScrollBar m_hScroll;
     ScrollBar m_vScroll;
     RowLabel *m_pRowLabel;
     ColumnLabel *m_pColLabel;
     App *m_pApp;
     Rect m_viewRect;
     int m_rowOffset;
     int m_colOffset;
     int m_playerRow;
     bool m_playing;
     // scroll bar connections
     boost::signals2::connection m_hScrollConn;
     boost::signals2::connection m_vScrollConn;
     
     int colWidth();
     void updateRects();
     int visibleRows();
     int visibleCols();
     int wholeVisibleRows();
     int wholeVisibleCols();
     void setRowOffset(int offset);
     void setColOffset(int colOffset);
     void connect();
     void setHScrollPos(int pos);
     void setVScrollPos(int pos);
};

#endif
